<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <jsp:include page="heading.jsp"></jsp:include>
    <%@ page import="java.util.*,java.text.*"%>
    <%@page import="dao.*" %>
    <%@page import="servlet.*" %>
<!DOCTYPE html >
<html>
<head>
<style type="text/css">
.div1{
width:80%;
margin:0px,auto;
margin-left:10%;

	
}
.mybtn{
	width: 86px;
text-align: center;
line-height: 100%;
padding-top: 0.5em;
padding-right: 2em;
padding-bottom: 0.55em;
padding-left: 2em;
font-family: "Arial Black", Gadget, sans-serif;
font-size: 14px;
font-style: normal;
font-variant: normal;
font-weight: normal;
text-decoration: none;
margin-top: 0px;
margin-right: 2px;
margin-bottom: 0px;
margin-left: 2px;
vertical-align: text-bottom;
display: inline-block;
cursor: pointer;
zoom:1;
outline-width:medium;
outline-color:inherit;
font-size-adjust:none;
font-stretch:normal;
border-top-left-radius:0.5em;
border-top-right-radius:0.5em;
border-bottom-left-radius:0.5em;
border-bottom-right-radius:0.5em;
box-shadow:0px 1px 2px rgba(0,0,0,0.2);
color:#fefee9;
border-top-color:#da7c0c;
border-right-color:#da7c0c;
border-bottom-color:#da7c0c;
border-left-color:#da7c0c;
border-top-width:1px;
border-right-width:1px;
border-bottom-width:1px;
border-left-width:1px;
border-top-style:solid;
border-right-style:solid;
border-bottom-style:solid;
border-left-style:solid;
background-image:none;
background-attachment:scroll;
background-repeat:repeat;
background-position-x:0%;
background-position-y:0%;
background-size:auto;
background-origin:padding-box;
background-clip:padding-box;
background-color:#f78d1d;
}
input{
border:none;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>订单详情</title>
</head>
<body>
	<%
			Userinfo bookOrder = (Userinfo) session.getAttribute("order");
		%>
		
		<%
		Map cart = (Map) session.getAttribute("cart");
		double total = 0;
		if (cart == null || cart.size() == 0)
			out.println("<p>购物车当前为空!</p>");
		else {
			
			Set cartItems = cart.keySet();
			Object[] isbn = cartItems.toArray();
			Goods good;
			CartItem cartItem;
			int quantity=0;
			double price, subtotal;
	%>
	<div class="div1">
	<form action="AddOrder" method="post">
		<table >
			<thead>
				<tr align="center">
					<th>书籍名称</th><th>数量</th><th>价格</th><th>小计</th>
				</tr>
			</thead>
			<%
				int i = 0;
					while (i < isbn.length) {
						cartItem = (CartItem) cart.get((String) isbn[i]);
						good = cartItem.getGood();
						quantity = cartItem.getQuantity();
						price = good.getPrice();
						subtotal = quantity * price;
						total += subtotal;
						i++;
			%>
			<tr>
				<td><input type="text" name="goodname" value= "<%=good.getName()%>"></td>
				<td align="center"><input type="text" name="quantity" value= "<%=quantity%>"></td>
				<td class="right">
				
				<input type="text" name="price" value="<%=new DecimalFormat("0.00").format(price)%>">	
				</td>
				<td class="bold right">
				<input type="text" name="subtotal" value="<%=new DecimalFormat("0.00").format(subtotal)%>">
					
				</td>
			</tr>
			<% 
				}
					%>
			<tr>
				<td colspan="4" class="bold right">
					<b>总计： </b><input type="text" name="total1" value="<%=new DecimalFormat("0.00").format(total)%>">
				</td>
			</tr>
		</table>
		
		<%
			}
		%>

 		<br>客户账户信息如下：<br>
		客户名：<input type="text" name="username" value="<%=bookOrder.getUsername()%>"><BR>	
		邮编：<input type="text" name="zipcode" value="<%=bookOrder.getZipcode()%>"><BR>
		电话：<input type="text" name="phone" value="<%=bookOrder.getPhone()%>"><BR>
		信用卡号<input type="text" name="creditcard" value="<%=bookOrder.getCreditcard()%>"><BR>
		地址：<input type="text" name="address" value="<%=bookOrder.getAddress() %>">
		总额：<input type="text" name="total" value="<%=bookOrder.getTotal()%>">
		
		<br/>
		本店将及时发货，请注意查收。欢迎再次光临，谢谢！<br>
		
		
			<input type="submit" value="确定" class="mybtn">
		</form>
	</div>
</body>
</html>